<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // new Set()方法去重
        let arr=[1,3,4,2,4,5,3];
        let arr2=new Set(arr)
        console.log([...arr2]);

        // forEach indexOf forEach 没有返回值
        let add=[]
        arr.forEach((item,i)=>{
            if(arr.indexOf(item)==i){
                add.push(item)
            }
        })
        console.log(add);
    </script>
</body>
</html>